package com.zzf.concurrent.example.design.pattern.future;

import com.zzf.concurrent.example.util.TimeUtil;
import lombok.extern.slf4j.Slf4j;

/**
 * @author GaoFeng2017
 * @date 2019/9/7 20:23
 */
@Slf4j
public class App {
    public static void main(String[] args) throws InterruptedException {
        FutureService<Integer> objectFutureService = new FutureService<>();

        Future<Integer> future = objectFutureService.submit(() -> {
            log.info("task will be handle...");
            TimeUtil.sleep(3000);
            log.info("task is finished.");
            return 1;
        }, System.out::println);

        log.info("=============");
        log.info("do other thing");
        log.info("=============");
        // log.info("result is {}", future.get());

    }
}
